package com.kyh.sys.entity;

import java.util.Date;

import javax.persistence.Table;

import com.alibaba.fastjson.JSONObject;
import com.kyh.annotation.Model;
import com.kyh.entity.base.BaseEntity;

/**
*/
@Table(name="sys_dict", catalog="dict_id")
public class Dict extends BaseEntity<Dict> {

	@Model(nameTable="dictId")
	private Long dictId; // 主键ID
	@Model(nameTable="dictKey")
	private String dictKey; // 关键字
	@Model(nameTable="dictValue")
	private String dictValue; // 值
	@Model(nameTable="dictName")
	private String dictName; // 名称
	@Model(nameTable="status")
	private Integer status; // 
	@Model(nameTable="createTime")
	private Date createTime; // 
	@Model(nameTable="updateTime")
	private Date updateTime; // 

	public Long getDictId() {
		return dictId;
	}
	public Dict setDictId(Long dictId) {
		this.dictId = dictId;
		return this;
	}
	public String getDictKey() {
		return dictKey;
	}
	public Dict setDictKey(String dictKey) {
		this.dictKey = dictKey;
		return this;
	}
	public String getDictValue() {
		return dictValue;
	}
	public Dict setDictValue(String dictValue) {
		this.dictValue = dictValue;
		return this;
	}
	public String getDictName() {
		return dictName;
	}
	public Dict setDictName(String dictName) {
		this.dictName = dictName;
		return this;
	}
	public Integer getStatus() {
		return status;
	}
	public Dict setStatus(Integer status) {
		this.status = status;
		return this;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public Dict setCreateTime(Date createTime) {
		this.createTime = createTime;
		return this;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public Dict setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
		return this;
	}
	
	public static Dict dict(
			String dictKey,
			String dictValue,
			String dictName,
			Integer status
			) {
		Dict entity = new Dict();
		entity.setDictKey(dictKey);
		entity.setDictValue(dictValue);
		entity.setDictName(dictName);
		entity.setStatus(status);
		return entity;
	}
	
	public JSONObject tree() {
		JSONObject JO = new JSONObject();
		
		JO.put("id", this.getDictId());
		JO.put("text", this.getDictName());
		JO.put("value", this.getDictValue());
		JO.put("type", "dict");
		return JO;
	}
}